package org.dtrd.modules.evaluation.entity.bean;

import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.dtrd.modules.evaluation.constant.Evaluation;
import org.dtrd.modules.evaluation.entity.po.DtrdEntEvaluationRdPersonality;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author QR
 * @Date 2021/11/2 11:14 AM
 */
@ApiModel("卡尔特16种人格因素评估数据")
@Data
public class PersonalityInfo {

    private Integer id;
    private Integer patientId;
    private List<Integer> input;
    private Integer faScore;
    private String faLevel;
    private Integer fbScore;
    private String fbLevel;
    private Integer fcScore;
    private String fcLevel;
    private Integer feScore;
    private String feLevel;
    private Integer ffScore;
    private String ffLevel;
    private Integer fgScore;
    private String fgLevel;
    private Integer fhScore;
    private String fhLevel;
    private Integer fiScore;
    private String fiLevel;
    private Integer flScore;
    private String flLevel;
    private Integer fmScore;
    private String fmLevel;
    private Integer fnScore;
    private String fnLevel;
    private Integer foScore;
    private String foLevel;
    private Integer fq1Score;
    private String fq1Level;
    private Integer fq2Score;
    private String fq2Level;
    private Integer fq3Score;
    private String fq3Level;
    private Integer fq4Score;
    private String fq4Level;
    private Float fx1Score;
    private String fx1Level;
    private Float fx2Score;
    private String fx2Level;
    private Float fx3Score;
    private String fx3Level;
    private Float fx4Score;
    private String fx4Level;
    private Integer fy1Score;
    private String fy1Level;
    private Integer fy2Score;
    private String fy2Level;
    private Integer fy3Score;
    private String fy3Level;
    private Integer fy4Score;
    private String fy4Level;
    private String output;
    private Date createTime;
    
    public PersonalityInfo parseFromPo(DtrdEntEvaluationRdPersonality po){
        
        this.setId(po.getDataId());
        this.setPatientId(po.getPatientId());
        ArrayList<Integer> answerArr = new ArrayList<>(Evaluation.ProblemNum.PERSONALITY.getNum());
        String answerStr = po.getInput();
        if (StrUtil.isNotBlank(po.getInput())){
            String[] strings = answerStr.split(",");
            for (String s : strings) {
                answerArr.add(Integer.parseInt(s));
            }
        }
        this.setInput(answerArr);
        this.setFaScore(po.getFaScore());
        this.setFaLevel(po.getFaLevel());
        this.setFbScore(po.getFbScore());
        this.setFbLevel(po.getFbLevel());
        this.setFcScore(po.getFcScore());
        this.setFcLevel(po.getFcLevel());
        this.setFeScore(po.getFeScore());
        this.setFeLevel(po.getFeLevel());
        this.setFfScore(po.getFfScore());
        this.setFfLevel(po.getFfLevel());
        this.setFgScore(po.getFgScore());
        this.setFgLevel(po.getFgLevel());
        this.setFhScore(po.getFhScore());
        this.setFhLevel(po.getFhLevel());
        this.setFiScore(po.getFiScore());
        this.setFiLevel(po.getFiLevel());
        this.setFlScore(po.getFlScore());
        this.setFlLevel(po.getFlLevel());
        this.setFmScore(po.getFmScore());
        this.setFmLevel(po.getFmLevel());
        this.setFnScore(po.getFnScore());
        this.setFnLevel(po.getFnLevel());
        this.setFoScore(po.getFoScore());
        this.setFoLevel(po.getFoLevel());
        this.setFq1Score(po.getFq1Score());
        this.setFq1Level(po.getFq1Level());
        this.setFq2Score(po.getFq2Score());
        this.setFq2Level(po.getFq2Level());
        this.setFq3Score(po.getFq3Score());
        this.setFq3Level(po.getFq3Level());
        this.setFq4Score(po.getFq4Score());
        this.setFq4Level(po.getFq4Level());
        this.setFx1Score(po.getFx1Score());
        this.setFx1Level(po.getFx1Level());
        this.setFx2Score(po.getFx2Score());
        this.setFx2Level(po.getFx2Level());
        this.setFx3Score(po.getFx3Score());
        this.setFx3Level(po.getFx3Level());
        this.setFx4Score(po.getFx4Score());
        this.setFx4Level(po.getFx4Level());
        this.setFy1Score(po.getFy1Score());
        this.setFy1Level(po.getFy1Level());
        this.setFy2Score(po.getFy2Score());
        this.setFy2Level(po.getFy2Level());
        this.setFy3Score(po.getFy3Score());
        this.setFy3Level(po.getFy3Level());
        this.setFy4Score(po.getFy4Score());
        this.setFy4Level(po.getFy4Level());
        this.setOutput(po.getOutput());
        this.setCreateTime(po.getCreateTime());
        return this;
    }
}
